"""
文件转换器主入口
"""

import sys
import tkinter as tk
from pathlib import Path

# 添加项目根目录到Python路径
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root))

from src.gui.main_window import MainWindow
from src.utils.logger import Logger
from src.config import ConfigManager


def main():
    """主函数"""
    try:
        # 初始化日志
        logger = Logger()
        logger.info("启动文件转换器应用程序")
        
        # 初始化配置
        config = ConfigManager()
        
        # 创建主窗口
        app = MainWindow(config, logger)
        
        # 启动应用
        app.run()
        
    except Exception as e:
        print(f"应用程序启动失败: {e}")
        sys.exit(1)


if __name__ == "__main__":
    main()
